import { http } from "@/utils/http";
import type { ResultProps } from "@/api/user";

export interface BusinessListProps {
  id: number;
  account_id: number;
  business_account_id: number;
  logo: string;
  brand: string;
  country: Country;
  province: string;
  city: string;
  detail_address: string;
  enable_status: number;
  operate_nature: OperateNature;
  operator: string;
  phone: string;
  delete_status: number;
  update_time: Date;
  create_time: Date;
  expire_time: null;
  store_num: number;
  device_num: number;
}

export enum Country {
  中国 = "中国"
}

export enum OperateNature {
  个人 = "个人",
  连锁 = "连锁"
}

export const businessGetList = (params?: object) => {
  return http.request<ResultProps<BusinessListProps[]>>(
    "get",
    "/business/getList",
    {
      params
    }
  );
};

export const businessAdd = (data?: object) => {
  return http.request<ResultProps<any>>("post", "/business/add", {
    data
  });
};

export const businessUpdate = (data?: object) => {
  return http.request<ResultProps<any>>("post", "/business/upd", {
    data
  });
};

export const businessDel = (data?: object) => {
  return http.request<ResultProps<any>>("post", "/softwareUpgrade/del", {
    data
  });
};
